package com.teaching.controller;

import com.teaching.common.ResultObject;
import com.teaching.service.RealTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;




/**
 * 
 * @author
 * @since
 */
@RestController
@RequestMapping("/realTime")
public class RealTimeController {


	@Autowired
	RealTimeService realTimeService;

	/** 统计发言次数最高的10个学生关系
	 * @param id
	 * @return
	 */
	@GetMapping("/query_relation_raisedhands_top10")
	public ResultObject query_relation_raisedhands_top10(){
		List<Map<String, Object>> result = realTimeService.query_relation_raisedhands_top10();
		return ResultObject.isOk(result);
	}


	/** 统计各分类访问资源数量
	 * @param id
	 * @return
	 */
	@GetMapping("/query_Class_resource_stats")
	public ResultObject query_Class_resource_stats(){
		List<Map<String, Object>> result = realTimeService.query_Class_resource_stats();
		return ResultObject.isOk(result);
	}

	/** 统计不同教育阶段的平均参与讨论次数
	 * @param id
	 * @return
	 */
	@GetMapping("/query_stage_discussion_stats")
	public ResultObject query_stage_discussion_stats(){
		Map<String, Object> result = realTimeService.query_stage_discussion_stats();
		return ResultObject.isOk(result);
	}

	/**统计不同年级的平均举手次数
	 * @param id
	 * @return
	 */
	@GetMapping("/query_grade_raisedhands_stats")
	public ResultObject query_grade_raisedhands_stats(){
		Map<String, Object> result = realTimeService.query_grade_raisedhands_stats();
		return ResultObject.isOk(result);
	}

       
       /** 统计访问资源次数最多的前5个学习主题
     	 * @param id
     	 * @return
     	 */
         @GetMapping("/query_topic_resources_top5")
         public ResultObject query_topic_resources_top5(){
			 Map<String, Object> result = realTimeService.query_topic_resources_top5();
          	return ResultObject.isOk(result); 
         }



	/**统计家长满意度分布
	 * @param id
	 * @return
	 */
	@GetMapping("/query_parent_satisfaction_dist")
	public ResultObject query_parent_satisfaction_dist(){
		List<Map<String, Object>> result = realTimeService.query_parent_satisfaction_dist();
		return ResultObject.isOk(result);
	}

	/**统计不同年级学生的平均在线资源访问量
	 * @param id
	 * @return
	 */
	@GetMapping("/query_gradeID_resources_stats")
	public ResultObject query_gradeID_resources_stats(){
		Map<String, Object> result = realTimeService.query_gradeID_resources_stats();
		return ResultObject.isOk(result);
	}


	/**词云图
	 * @param id
	 * @return
	 */
	@GetMapping("/query_word_num")
	public ResultObject query_word_num(){
		List<Map<String, Object>> result = realTimeService.query_word_num();
		return ResultObject.isOk(result);
	}

}
